#include<iostream>

class Range {

	private:
	float a;
	float b;
	int lock=0;
	
	public:
	Range(float a, float b);
	bool rangeCheck(float x);
	float getA();
	bool setA(float a);
	float getB();
	bool setB(float b);
	
	protected:
	void lockDown();
	void lockUp();
	

	void Range::Range(float a, float b) {
		this.a = a;
		this.b = b;
		if(b<a){
			float c=a;
			a=b;
			b=c;
		}
	}

	bool Range::rangeCheck(float x){
		if (a>b){
			if(x<a || x>b){
				return false;
			}
			return true;
		}
		else std::cout<<"errore";
	}
	
	float Range::getA() {
		return a;
	}

	bool Range::setA(float a) {
		if(lock==0 && a<=this.b){
			this.a = a;
			return true;
		}
		return false;
	}

	float Range::getB() {
		return b;
	}

	bool Range::setB(float b) {
		if(lock==0 && this.a<=b){
			this.b = b;
			return true;
		}
		return false;
	}

	protected:
	void Range::lockDown(){
		lock--;
	}
	void Range::lockUp(){
		lock++;
	}
}
